home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 09 - 1993 / 09.02 Feb 93 / Screen I⁄O Classes / B Classes / B.c / BGetTCLInfo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-12  |  1.8 KB  |  85 lines  |  [TEXT/KAHL]

  1. /*******************************************************************
  2.  * BGetTCLInfo.c
  3.  *
  4.  * SUPERCLASS = CDLOGDirector
  5.  *
  6.  * Dialog class which prompts user for information and then return his input.
  7.  *  
  8.  * © copyright 1991, KSS Scientific Consultants.
  9.  *
  10.  ******************************************************************/
  11.  
  12. #include <CDialogText.h>
  13. #include <CWindow.h>
  14. #include <Commands.h>
  15. #include <string.h>
  16. #include "BGetTCLInfo.h"
  17.  
  18. enum    // dialog item IDs
  19. {
  20.     kReturnStr = 2,
  21.     kPrompt
  22. };
  23.  
  24. /*******************************************************************
  25.  * IBGetTCLInfo()
  26.  *
  27.  * Initialization method.
  28.  *
  29.  *******************************************************************/
  30.  
  31. void BGetTCLInfo::IBGetTCLInfo(short DLOGid, CDirectorOwner *aSupervisor)
  32. {
  33.     CDLOGDirector::IDLOGDirector(DLOGid, aSupervisor);
  34. }
  35.  
  36. /**********************************************************************
  37.  * DoCommand()
  38.  *
  39.  * *******************************************************************/
  40.  
  41. void BGetTCLInfo::DoCommand(long theCommand)
  42. {
  43.     CDialogText        *theText;
  44.     
  45.     switch (theCommand)
  46.     {
  47.         case cmdOK:
  48.             theText = (CDialogText*)itsWindow->FindViewByID(kReturnStr);
  49.             theText->GetTextString(fReturnStr);
  50.             EndDialog( cmdOK, TRUE);
  51.             break;
  52.  
  53.         default:
  54.             inherited::DoCommand(theCommand);
  55.             break;
  56.     }
  57.     
  58. }
  59.  
  60. /*********************************************************************
  61.  * GetInfo()
  62.  *
  63.  * Entry method.
  64.  *
  65.  *********************************************************************/
  66.  
  67. void BGetTCLInfo::GetInfo(char *promptPtr, char *returnPtr)
  68. {
  69.     long            theCommand;
  70.     CDialogText        *staticItem;
  71.     Str255            tempStr;
  72.     
  73.     strcpy((char*)tempStr, promptPtr);
  74.     CtoPstr((char*)tempStr);
  75.     staticItem = (CDialogText*)itsWindow->FindViewByID(kPrompt);
  76.     staticItem->SetTextString(tempStr);
  77.  
  78.     // show the dialog
  79.     BeginDialog();
  80.     
  81.     theCommand = DoModalDialog(cmdOK);
  82.     
  83.     strcpy(returnPtr, (char*)fReturnStr);
  84. }
  85.